package com.wedo.book.mapper;

import com.wedo.book.pojo.Book;
import com.wedo.book.result.BookHotResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BookMapper extends Mapper<Book> {
    @Select("select b.id,b.title,b.intro,b.image,bh.hot,a.name from book b join book_hot bh,author a where b.c_id = #{cid} and bh.b_id = b.id and a.id = b.a_id order by bh.hot desc limit #{rows};")
    List<BookHotResult> queryBooksByCidAndHot(@Param("cid") Long cid, @Param("rows") Integer rows);
}
